﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class admin_login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //清空连接信息
        Session.Clear();
    }
    protected void loginButton_Click(object sender, EventArgs e)
    {
        messageLabel.Text = "";
        string name = userNameTextBox.Text;
        string password = passwordTextBox.Text;
        DB db = new DB();
        int result = db.login(name,password);
        if (result > 0)
        {
            Session.Add("userId", result);
            Session.Add("userName",name);
            Response.Redirect("manage.aspx");
        }
        else//登陆失败
        {
            messageLabel.Text = "用户名密码错误!";
        }
    }
}
